package com.cnkvha.trackcontestmgmt.ui.track;

import com.cnkvha.trackcontestmgmt.TrackContestManagement;
import com.cnkvha.trackcontestmgmt.contest.Contest;

import javax.swing.table.AbstractTableModel;

public class TrackInfoTableModel extends AbstractTableModel {

    @Override
    public int getRowCount() {
        Contest c = TrackContestManagement.instance.getCurrentContest();
        if(c == null) return 0;
        return c.tracks.length;
    }

    @Override
    public int getColumnCount() {
        return 6;
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0: return "指示";
            case 1: return "赛道";
            case 2: return "参赛者";
            case 3: return "时间";
            case 4: return "计时员";
            case 6: return "名次";
            default: return "?";
        }
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return TrackContestManagement.instance.getCurrentContest();
    }
}
